package service.impl;

import java.sql.SQLException;
import java.util.List;

import dao.UserDao;
import dao.Factoty.DaoFactory;
import domain.User;
import service.UserService;

public class UserServiceImpl implements UserService {
	
	UserDao userDao = DaoFactory.getUserDaoInstance();

	@Override
	public User login(User user) throws SQLException {
		User loginUser = userDao.signin(user);
		return loginUser;
	}

	@Override
	public User signin(User user) throws SQLException {
		User loginUser = userDao.login(user);
		return loginUser;
	}

	@Override
	public boolean register(User user) throws SQLException {
		return userDao.register(user);
	}

	@Override
	public User findUserById(int id) throws SQLException {
		User user = userDao.findUserById(id);
		return user;
	}

	@Override
	public boolean updateUser(User user) throws SQLException {
		return userDao.updateUser(user);
	}

	@Override
	public List<User> findUsers(String id, String username, int page, int limit) throws SQLException {
		// TODO Auto-generated method stub
		return userDao.findUsers(id, username, page, limit);
	}

}
